from typing import Optional

from fastapi_amis_admin.models import Field

from ..common import AppBaseModel


class BizDictType(AppBaseModel, table=True):
    __tablename__ = 'sys_busi_dict_data'
    __table_args__ = {'extend_existing': True}
    pid: Optional[int] = Field(title='业务字典父ID')
    check_items_value: Optional[str] = Field(title='父ID',
                                      alias="checkItemsValue",
                                      serialization_alias="checkItemsValue",
                                      validation_alias="checkItemsValue")
    dict_type_id: Optional[int] = Field(nullable=False, title='业务字典类型ID',
                                      alias="dictTypeId",
                                      serialization_alias="dictTypeId",
                                      validation_alias="dictTypeId")
    dict_type_value: Optional[str] = Field(nullable=False, title='业务字典类型值',
                                      alias="dictTypeValue",
                                      serialization_alias="dictTypeValue",
                                      validation_alias="dictTypeValue")
    dict_data_label: Optional[str] = Field(nullable=False, title='业务字典标签',
                                      alias="dictDataLabel",
                                      serialization_alias="dictDataLabel",
                                      validation_alias="dictDataLabel")
    acronymy: Optional[str] = Field(default='', title='首字母拼音')
    wb: Optional[str] = Field(default='', title='首字母五笔')
    dict_data_value: Optional[str] = Field(default='', nullable=False, title='业务字典值',
                                      alias="dictDataValue",
                                      serialization_alias="dictDataValue",
                                      validation_alias="dictDataValue")
    remark: Optional[str] = Field(default='', title='备注')
    sort: Optional[int] = Field(default=0, title='排序')


class SysBusiDictType(AppBaseModel, table=True):
    __tablename__ = 'sys_busi_dict_type'
    __table_args__ = {'extend_existing': True}
    busi_type: Optional[str] = Field(nullable=False,title='业务字典类型',description="1->仓库  2->药品   3->物质    4->设备    5->门诊    6->队友   7->多级字典",
                                      alias="busiType",
                                      serialization_alias="busiType",
                                      validation_alias="busiType")
    dict_type_label: Optional[str] = Field(nullable=False, title='业务字典类型标签',
                                      alias="dictTypeLabel",
                                      serialization_alias="dictTypeLabel",
                                      validation_alias="dictTypeLabel")
    dict_type_value: Optional[str] = Field(nullable=False, title='业务字典类型值',
                                      alias="dictTypeValue",
                                      serialization_alias="dictTypeValue",
                                      validation_alias="dictTypeValue")
    remark: Optional[str] = Field(default='', title='备注')
    sort: Optional[int] = Field(default=0, title='排序')
